
package org.bridgen.lang.semantics.ast;
import java.util.*;



public abstract class RelationalExpr extends BoolExpr implements Cloneable {
    public void flushCache() {
        super.flushCache();
    }
     @SuppressWarnings({"unchecked", "cast"})  public RelationalExpr clone() throws CloneNotSupportedException {
        RelationalExpr node = (RelationalExpr)super.clone();
        node.in$Circle(false);
        node.is$Final(false);
    return node;
    }
    // Declared in PrettyPrint.jrag at line 232

    
    public void pp(StringBuffer buf) {
    	getLeft().pp(buf);
    	buf.append(" " + operator() + " ");
    	getRight().pp(buf);
    }

    // Declared in TypeAnalysis.jrag at line 55

	
	/**
	 * Checking:
	 * 1) Operands in relational expressions must have the same type
	 */
	public void typeAnalysis(Collection errorList) {
		super.typeAnalysis(errorList);
		String leftType = getLeft().type();
		String rightType = getRight().type();
		if (!leftType.equals(rightType)) {
			error(errorList, "Type mismatch in operands: " + leftType + 
				" " + operator() + " " + rightType);
		}
	}

    // Declared in TypeCodeGen.jrag at line 466

	
	public void generateCode(String indent, StringBuffer buf) {
		getLeft().generateCode(indent, buf);
		buf.append(" " + operator() + " ");
		getRight().generateCode(indent, buf);
	}

    // Declared in bridgit.ast at line 3
    // Declared in bridgit.ast line 96

    public RelationalExpr() {
        super();


    }

    // Declared in bridgit.ast at line 10


    // Declared in bridgit.ast line 96
    public RelationalExpr(Expr p0, Expr p1) {
        setChild(p0, 0);
        setChild(p1, 1);
    }

    // Declared in bridgit.ast at line 15


  protected int numChildren() {
    return 2;
  }

    // Declared in bridgit.ast at line 18

  public boolean mayHaveRewrite() { return false; }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 96
    public void setLeft(Expr node) {
        setChild(node, 0);
    }

    // Declared in bridgit.ast at line 5

    public Expr getLeft() {
        return (Expr)getChild(0);
    }

    // Declared in bridgit.ast at line 9


    public Expr getLeftNoTransform() {
        return (Expr)getChildNoTransform(0);
    }

    // Declared in bridgit.ast at line 2
    // Declared in bridgit.ast line 96
    public void setRight(Expr node) {
        setChild(node, 1);
    }

    // Declared in bridgit.ast at line 5

    public Expr getRight() {
        return (Expr)getChild(1);
    }

    // Declared in bridgit.ast at line 9


    public Expr getRightNoTransform() {
        return (Expr)getChildNoTransform(1);
    }

    // Declared in PrettyPrint.jrag at line 8
 @SuppressWarnings({"unchecked", "cast"})     public String operator() {
        String operator_value = operator_compute();
        return operator_value;
    }

    private String operator_compute() {  return "";  }

public ASTNode rewriteTo() {
    return super.rewriteTo();
}

}
